/*
 * Command.cpp
 *
 *  Created on: 2011-11-18
 *      Author: kaishui
 */

#include "Command.h"

bool PC_Command::isCorrect()
{
	unsigned short ck=Command^Reserver1^Reserver2^Depat^SubDep;
	ck=ck^(Value>>16)^((unsigned short)Value);

	if(ck==check)
		return true;
	return false;
}


PC_Command& PC_Command::operator =(PC_Command &temp)//赋值运算符重载函数
{
	this->Command=temp.Command;
	this->Reserver1=temp.Reserver1;
	this->Reserver2=temp.Reserver2;
	this->Depat=temp.Depat;
	this->SubDep=temp.SubDep;
	this->Value=temp.Value;
	this->bDebug=temp.bDebug;
	this->check=temp.check;
	return *this;
}


void ARM_Command::CalcCheck()
{
	check=Command^Status^SubDep^Depat;
	check=check^(pos>>16)^((unsigned short)pos);
	check=check^(Error>>16)^((unsigned short)Error);
}
